#pragma once
#ifndef __NEZHACFILELIST_H__
#define __NEZHACFILELIST_H__

#include "NezhaIFileList.h"
#include "NezhaOS.h"

namespace Nezha
{
	namespace stream
	{
		class NEZHA_ENGINE_ENTRY CFileList : public IFileList
		{
		public:
			CFileList();
			
			virtual u32 getFileCount() const;

			virtual const char* getFileName(u32 index) const;

			virtual const char* getFullFileName(u32 index);

			virtual bool isDirectory(u32 index) const;

		private:

			struct FileEntry
			{
				String		mName;
				String		mFullName;
				long		mSize;
				bool		isDirectory;

				bool operator <(const struct FileEntry& other) const
				{
					if ( isDirectory ^ other.isDirectory )
						return isDirectory;
#if defined(NZOS_IOS)
					return ::strcmp(mName.c_str(), other.mName.c_str()) < 0;
#elif defined(NZOS_WIN32)
                    return ::_stricmp(mName.c_str(), other.mName.c_str()) < 0;
#else
                    //defaults to stricmp
                    return ::stricmp(mName.c_str(), other.mName.c_str()) < 0;
#endif
				}
			};

			String					mPath;
			std::vector<FileEntry>	mFiles;
		};
	};
};

#endif // __NEZHACFILELIST_H__